import Vuex from 'vuex';
import Vue from 'vue';

import actions from './actions';
import mutations from './mutations';
import getters from './getters';


Vue.use(Vuex)

// import * as types from './types'
// import api from './../http/api.js'
const store = new Vuex.Store({
    state: {
        count:10,
        value:'',
    },
    getters: {
    
        count:(state)=>{
            console.log(state.count)
             return state.count;
        },
        value:(state)=>{
            return state.value;
        }
    },
    mutations: {
        // add:(state)=>{
        //     console.log(state)
        //     state.count++;
        // },
        // loadMore:(state)=>{
        //     this.loading = true;
        //     setTimeout(() => {
        //         let last = this.list[this.list.length - 1];
        //         for (let i = 1; i <= 10; i++) {
        //         this.list.push(last + i);
        //         }
        //         this.loading = false;
        //     }, 2500);
        // },
        search:(state)=>{
            alert(99)
            
        },
    },
    actions: {
        //  loadMore:({commit})=>{
        //      commit('loadMore')
        //  },
         search:({commit})=>{
            commit('search')
        }
    }
})

export default {
    store,
    actions,
    mutations,
    getters
};